<template>
  <div>
    <el-row>
      <el-col :span="16">
        <el-date-picker
          v-model="date"
          type="date"
          placeholder="选择日期"
          size="mini"
          :disabled="true"
        >
        </el-date-picker>
      </el-col>
      <el-col :span="4">
        <el-input size="mini" v-model="table.reportPerson">
          <template slot="prepend">填报人</template>
        </el-input>
      </el-col>
      <el-col :span="4" style="text-align: right">
        <el-button size="mini" @click="saveFn">保存</el-button>
      </el-col>
    </el-row>

    <com :tableData="table.noon" :total="table.totalNoon"></com>
  </div>
</template>
<script>
import com from './com.vue'
export default {
  components: { com },
  data () {
    return {
      activeName: 'first',
      date: null,
      table: {
        night: [],
        morning: [],
        noon: [],
        totalNight: {},
        totalMorning: {},
        totalNoon: {},
        reportPerson: ''
      }
    }
  },
  methods: {
    handleClick (tab, event) {
      console.log(tab, event)
    },
    saveFn () {
      alert(JSON.stringify(this.table))
      console.log(this.table)
    },
    resetFn () {
      this.table = {
        night: [],
        morning: [],
        noon: [],
        totalNight: {},
        totalMorning: {},
        totalNoon: {},
        reportPerson: ''
      }

      this.date = null
      this.$message.success('重置成功')
    },
    getTable () {
      if (!this.date) {
        this.$message.error('请选择查询日期')
        return
      }
      console.log()
    },
    editFn () {
      this.$router.push({
        name: 'pagetableEditlog',
        params: {
          id: 1
        },
        query: {
          // 1编辑，2新增
          edit: 1
        }
      })
    }
  }
}
</script>
